package org.sergiy.metawidget.rules;

import java.io.Serializable;

/**
 * Test class for rules
 *  
 * @author Sergiy Litsenko
 *
 */
public class DomainObject implements Serializable{
	private static final long serialVersionUID = 1173071440245810933L;
	
	private boolean outcomeSet;
	private int outcomeWeight;
	private String outcome;
	
	public DomainObject() {
		
	}
	
	public DomainObject(boolean isOutcomeSet, int outcomeWeight, String outcome) {
		super();
		this.outcomeSet = isOutcomeSet;
		this.outcomeWeight = outcomeWeight;
		this.outcome = outcome;
	}
	
	public boolean isOutcomeSet() {
		return outcomeSet;
	}
	public void setOutcomeSet(boolean isOutcomeSet) {
		this.outcomeSet = isOutcomeSet;
	}
	public int getOutcomeWeight() {
		return outcomeWeight;
	}
	public void setOutcomeWeight(int outcomeWeight) {
		this.outcomeWeight = outcomeWeight;
	}
	public String getOutcome() {
		return outcome;
	}
	public void setOutcome(String outcome) {
		this.outcome = outcome;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((outcome == null) ? 0 : outcome.hashCode());
		result = prime * result + (outcomeSet ? 1231 : 1237);
		result = prime * result + outcomeWeight;
		return result;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (!(obj instanceof DomainObject))
			return false;
		DomainObject other = (DomainObject) obj;
		if (outcome == null) {
			if (other.outcome != null)
				return false;
		} else if (!outcome.equals(other.outcome))
			return false;
		if (outcomeSet != other.outcomeSet)
			return false;
		if (outcomeWeight != other.outcomeWeight)
			return false;
		return true;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return String.format(
				"DomainObject [outcomeSet=%s, outcomeWeight=%s, outcome=%s]",
				outcomeSet, outcomeWeight, outcome);
	}
}
